package intermediate_representation;

import symbal.Vtype;

import java.util.ArrayList;

public class FuncDefRP extends InterRP {
    private String name;
    private Vtype returntype;
    private ArrayList<ParaRP> paraRPS;

    public FuncDefRP(String name, Vtype returntype) {
        this.name = name;
        this.returntype = returntype;
        this.paraRPS = new ArrayList<>();
    }

    public void addPara(ParaRP paraRP) {
        this.paraRPS.add(paraRP);
    }

    public String getName() {
        return name;
    }

    public Vtype getReturntype() {
        return returntype;
    }

    public ArrayList<ParaRP> getParaRPS() {
        return paraRPS;
    }

    public String toString() {
        String str = returntype.toString() + " " + name;
        for (ParaRP paraRP: paraRPS) {
            str += "\n" + paraRP.toString();
        }
        return str;
    }
}
